uniform extern texture gTex;
float timer = 0.0f;

sampler TexS = sampler_state {
	Texture = <gTex>;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	//AddressU  = WRAP;
    //AddressV  = WRAP;
};

struct OutputVS {
    float4 posH   : POSITION0;
	float2 Tex   : TEXCOORD0;
};


OutputVS WiggleVS(float4 posL : POSITION0,float2 Tex: TEXCOORD0) {
    // Zero out our output.
	OutputVS outVS = (OutputVS)0;	
	// already transformed
	outVS.posH = posL;	
	outVS.Tex = Tex; 
    return outVS;
}

float4 WigglePS(float2 Tex : TEXCOORD0) : COLOR {    
	Tex.x += sin(timer+Tex.x*10)*0.01f;
    Tex.y += cos(timer+Tex.y*10)*0.01f;
    float4 Color = tex2D(TexS, Tex); 
    return Color; 
}

technique WiggleTech {

    pass P0 {
        vertexShader = compile vs_2_0 WiggleVS();
        pixelShader  = compile ps_2_0 WigglePS();
    }
}